#include <bits/stdc++.h>
using namespace std;
#include <atcoder/fenwicktree>
using namespace atcoder;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e5 + 5;

int n, m;
int a[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 0, n - 1) cin >> a[i];
  fenwick_tree<ll> bit(n);
  rep(i, 0, n - 1) bit.add(i, a[i]);
  while (m--) {
    int op, x, y;
    cin >> op >> x >> y;
    if (!op)
      bit.add(x, y);
    else
      cout << bit.sum(x, y) << endl;
  }
  return 0;
}